package com.zb.service.impl;

import com.zb.dao.StudentDao;
import com.zb.entity.Student;
import com.zb.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by user on 2019/2/27.
 */
@Service
@Transactional
public class StudentServiceImpl implements StudentService {
    @Autowired
    private StudentDao dao;

    @Override
    public List<Student> listMytable() {
        return dao.listStudent();
    }

    @Override
    public Student showTwoTable(int id) {
        return dao.showTwoTable(id);
    }

    @Override
    public int update(String sname,int cid,int id) {
        Map<String,Object> map=new HashMap<>();
        map.put("sname",sname);
        map.put("cid",cid);
        map.put("id",id);
        System.out.print("zzz");
        return dao.update(map);

    }

    @Override
    public int add(String sname, int cid) {
        Map<String,Object> map=new HashMap<>();
        map.put("sname",sname);
        map.put("cid",cid);
        return dao.add(map);
    }

    @Override
    public int del(int id) {
        return dao.del(id);
    }
}
